﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using DMS.Business.Modules.SupplierManagement;
using DMS.Business.Utility;
using DMS.Business.Modules.Organization;
using System.Web.Caching;

namespace DMS.Business.Utility
{
    public class SystemContext
    {
        /// <summary>
        /// 获取当前应用上下文信息
        /// </summary>
        public static SystemContext Current
        {
            get
            {
                return new SystemContext();
            }
        }

        /// <summary>
        /// 获取当前登录的内部用户
        /// </summary>
        public User LoginUser
        {
            get
            {
                return UserHelper.GetContextUser();
            }
        }
        /// <summary>
        /// 获取当前登录的供应商
        /// </summary>
        public SupplierAccount LoginSupplier
        {
            get
            {
                return SupplierHelper.GetContextAccount();
            }
        }
        public AuthenticationUser LoginAuthUser
        {
            get
            {
                AuthenticationUser aUser = this.LoginUser;
                if (aUser == null)
                {
                    aUser = this.LoginSupplier;
                }
                return aUser;
            }
        }
    }
}
